/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package de.hsmannheim.pepa.patientenportal.apanwep.service.persistence;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;

import java.io.Serializable;

/**
 * @author Cedric Nana
 */
public class messages_mobjectsPK implements Comparable<messages_mobjectsPK>,
	Serializable {
	public long messages_ID;
	public long messageobjects_id;

	public messages_mobjectsPK() {
	}

	public messages_mobjectsPK(long messages_ID, long messageobjects_id) {
		this.messages_ID = messages_ID;
		this.messageobjects_id = messageobjects_id;
	}

	public long getMessages_ID() {
		return messages_ID;
	}

	public void setMessages_ID(long messages_ID) {
		this.messages_ID = messages_ID;
	}

	public long getMessageobjects_id() {
		return messageobjects_id;
	}

	public void setMessageobjects_id(long messageobjects_id) {
		this.messageobjects_id = messageobjects_id;
	}

	@Override
	public int compareTo(messages_mobjectsPK pk) {
		if (pk == null) {
			return -1;
		}

		int value = 0;

		if (messages_ID < pk.messages_ID) {
			value = -1;
		}
		else if (messages_ID > pk.messages_ID) {
			value = 1;
		}
		else {
			value = 0;
		}

		if (value != 0) {
			return value;
		}

		if (messageobjects_id < pk.messageobjects_id) {
			value = -1;
		}
		else if (messageobjects_id > pk.messageobjects_id) {
			value = 1;
		}
		else {
			value = 0;
		}

		if (value != 0) {
			return value;
		}

		return 0;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (!(obj instanceof messages_mobjectsPK)) {
			return false;
		}

		messages_mobjectsPK pk = (messages_mobjectsPK)obj;

		if ((messages_ID == pk.messages_ID) &&
				(messageobjects_id == pk.messageobjects_id)) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (String.valueOf(messages_ID) +
		String.valueOf(messageobjects_id)).hashCode();
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(10);

		sb.append(StringPool.OPEN_CURLY_BRACE);

		sb.append("messages_ID");
		sb.append(StringPool.EQUAL);
		sb.append(messages_ID);

		sb.append(StringPool.COMMA);
		sb.append(StringPool.SPACE);
		sb.append("messageobjects_id");
		sb.append(StringPool.EQUAL);
		sb.append(messageobjects_id);

		sb.append(StringPool.CLOSE_CURLY_BRACE);

		return sb.toString();
	}
}